public class ThreadDemo6 {
    public static boolean isJude = false;
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while(!isJude) {
                System.out.println("hello t");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("线程终止");
        });

        thread.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        isJude = true;
    }
}
